from django.shortcuts import render
# from rest_framework.views import APIView
from django_redis import get_redis_connection
# from rest_framework.response import Response
from rest_framework import status
from random import randint
import logging

# from meiduo_mall.libs.yuntongxun.sms import CCP
# logger = logging.getLogger('django')
#
# class SMSCodeView(APIView):
# #     #短信验证码
# #
#     def get(self, request, mobile):
# #
# #         # 创建redis连接对象
#         redis_conn = get_redis_connection('verify_codes')
#         # 先从redis获取此手机号发送短信标记
#         send_flag = redis_conn.get('send_flag_%s' % mobile)
#
#         #要设置send_flag在redis中存储的时间
#
#
#         if send_flag:# 如果此手机号在60秒内发过短信提前响应不执行后续发短信代码
#             return Response({'message': '频繁发送验证码'}, status=status.HTTP_400_BAD_REQUEST)
#
#         #生成短信验证码
#         sms_code = '%06d' % randint(0,999999)
#         logger.info(sms_code)

        # 利用容联云通讯SDK 发送验














